package algorithm.poj.p1000;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLDecoder;

/**
 * 分析：
 * 
 * 实现：
 * 
 * 经验：
 * 
 * 教训：
 * 
 * @author wong.tong@gmail.com
 *
 */
public class P1666 {

	public static void main(String[] args) throws Exception {

		InputStream input = null;
		if (false) {
			input = System.in;
		} else {
			URL url = P1666.class.getResource("P1666.txt");
			File file = new File(URLDecoder.decode(url.getPath(), "UTF-8"));
			input = new FileInputStream(file);
		}
		
		BufferedReader stdin = new BufferedReader(new InputStreamReader(input));

		String line = stdin.readLine();
		while (line != null && !"0".equals(line)) {
			int N = Integer.valueOf(line);
			int[] ns = new int[N];
			for (int i = 0; i < N; i ++) {
				line = stdin.readLine();
				ns[i] = Integer.valueOf(line);
			}
			int count = 0;
			int m = 0;
			while (true) {
				m = ns[0];
				boolean same = true;
				for (int i = 1; i < ns.length; i ++) {
					if (ns[i] != m) {
						same = false;
						break;
					}
				}
				if (same) {
					break;
				} else {
					count ++;
					int[] ms = new int[N];
					for (int i = 0; i < N; i ++) { ms[i] = ns[i]; }
					for (int i = 1; i < N; i ++) {
						ns[i] = (ms[i]>>1) + (ms[i-1]>>1);
					}
					ns[0] = (ms[0]>>1) + (ms[N-1]>>1);
					
					for (int i = 0; i < N; i ++) {
						if (ns[i]%2 == 1) {
							ns[i] ++;
						}
					}
				}
			}
			System.out.println(count + " " + m);
			line = stdin.readLine();
		}
	}
}